﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ManageBanking.Models;

namespace ManageBanking.Controllers
{
    public class UpdateUserController : Controller
    {
        //
        // GET: /UpdateUser/

        private UpdateUserModels udum = new UpdateUserModels();

        public ActionResult UpdateUser()
        {
            if (Session["Check"] == null)
                Session["Check"] = false;
            return View();
        }

        public ActionResult ResolveUpdateUser(string idusername, string username, string name, string birth, string address, string PlaceBirth, string job)
        {
            Session["Check"] = true;
            try
            {
                udum.UpdateUsername(Convert.ToInt32(idusername), username, name, Convert.ToDateTime(birth), address, PlaceBirth, job);
                return RedirectToAction("UpdateUser", "UpdateUser");
            }
            catch
            {
                Session["Check"] = false;
            }
            return RedirectToAction("UpdateUser", "UpdateUser");
        }

    }
}
